<template>
  <div id="app">
<!--    <div id="nav">-->
<!--      <router-link to="/">Home</router-link> |-->
<!--      <router-link to="/about">About</router-link>-->
<!--    </div>-->
    <router-view/>
  </div>
</template>

<script>
    export default {
        name: "app",
        data(){
            return{

            }
        },
        created() {
            this.$axios.get('http://49.232.131.98/mqtt/data/new_val').then((res) => {
                this.$store.state.totalInfor = res.data.data.data;
            }).catch((err) => {

                console.log(err)

            });
            this.$axios.get('http://49.232.131.98/mqtt/data/list').then((res) => {
                // console.log(res);
                let a = res.data.data.data
                // console.log(a)
                var timeAr = []
                var temAr = [];
                var oxAr = [];
                var phAr = [];
                var saltAr = [];
                var nhAr = [];
                var zhuoAr = [];
                for(var i=0;i<a.length;i++){
                    // this.$store.state.temArr.push(a[i].temperature)
                    // this.$store.state.oxArr.push(a[i].dissolvedOxygen)
                    // this.$store.state.phArr.push(a[i].phValue)
                    // this.$store.state.saltArr.push(a[i].salinity)
                    temAr.push(a[i].temperature)
                    oxAr.push(a[i].dissolvedOxygen)
                    phAr.push(a[i].phValue)
                    saltAr.push(a[i].salinity)
                    nhAr.push(a[i].anconcentration)
                    zhuoAr.push(a[i].turbidity)
                    timeAr.push(a[i].createTime)
                }
                this.$store.state.temArr = temAr
                this.$store.state.oxArr = oxAr
                this.$store.state.phArr = phAr
                this.$store.state.saltArr = saltAr
                this.$store.state.nhArr = nhAr
                this.$store.state.zhuoArr = zhuoAr
                this.$store.state.timeInfor = timeAr
                // this.totalInfor = res
            }).catch((err) => {

                console.log(err)

            })
        },
        mounted() {

        },
        methods:{

        }
    }
</script>

<style lang="less">

</style>
